<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Guestbook_model extends CI_Model
{
	// Guestbook all
	public function get_all_guestbook()
	{
		$this->db->order_by("id", "desc");
		
		$query = $this->db->get("guestbook");
		
		if($query->num_rows() > 0)
		{
			return $query->result_array();
		}
		return false;
	}
	
	// Insert guestbook message
	public function new_guestbook_entry($name, $message)
	{
		$data = array(
		   'name'		=> $name ,
		   'message'	=> $message);

		$this->db->insert('guestbook', $data); 
		return true;
	}
}